
<div id="conte-middle">
	<section class="posts">
<?php
	if(isset($episode)){
?>
		<article>
			<header>
				<h1><?php echo $title; ?></h1>
				<p><?php echo lang('v_posted_by'); ?> <span><?php echo $episode['posted_by']; ?></span> <?php echo lang('v_the'); ?> 
					<time datetime="<?php echo $episode['date']; ?>"><?php echo $episode['date']; ?></time>. <?php echo lang('v_updated'); ?> 
					<time datetime="<?php echo $episode['last_update']; ?>"><?php echo $episode['last_update']; ?></time></p>
			</header>
			<div class="post-conte">
				<div class="post-poster float-l">
					<img src="<?php echo $episode['url_poster_big']; ?>" width="277" height="312" />
					<span><?php echo $episode['type']; ?></span>
				</div>
				
				<div class="post-info float-r">
					<nav>
						<ul>
						<?php
							$url_cat = '';
							foreach ($episode['categories'] as $keyc => $categorie) {
						 		echo '<li><a href="'.Sys::$url_base.$lang_url.'series~'.$categorie['id'].'/'.'"'.($keyc==0?' class="first"': '').'>'.$categorie['name'].'</a></li>';
							}
							
							$url_season = base_url($lang_url.'series~'.$episode['id_season'].'~'.$episode['clean_title_serie'].'~temporada~'.$episode['no_season']);
						?>
						</ul>
						<div class="clear"></div>
					</nav>
					
					<div class="info">
						<table class="tbl-info">
							<tr>
								<td class="hed" colspan="2"><a href="<?php echo $url_season; ?>"><?php echo lang('v_season').' '.$episode['no_season']; ?></a></td>
							</tr>
							<tr>
								<td class="hed"><?php echo lang('v_release_date'); ?></td>
								<td><?php echo $episode['date_release']; ?></td>
							</tr>
							<tr>
								<td class="hed"><?php echo lang('v_language'); ?></td>
								<td><?php echo $episode['language']; ?></td>
							</tr>
							<tr>
								<td class="hed"><?php echo lang('v_subtitle'); ?></td>
								<td><?php echo $episode['subtitle']; ?></td>
							</tr>
							<tr>
								<td class="hed"><?php echo lang('v_format'); ?></td>
								<td><?php echo $episode['format_episode']; ?></td>
							</tr>
							<tr>
								<td class="hed"><?php echo lang('v_quality'); ?></td>
								<td><?php echo $episode['quality']; ?></td>
							</tr>
							<tr>
								<td class="hed"><?php echo lang('v_duration'); ?></td>
								<td><?php echo $episode['duration']; ?></td>
							</tr>
							<tr>
								<td class="hed"><?php echo lang('v_size'); ?></td>
								<td><?php echo $episode['size']; ?></td>
							</tr>
							<tr>
								<td class="hed"><?php echo lang('v_servers'); ?></td>
								<td><?php //Nombres de los servidores
								if(is_array($episode['sources'])){
									$ser = $download = '';
									foreach($episode['sources'] as $keys => $source){
										$ser .= ', <a href="'.$source['short'].'" class="serverss '.$source['name'].'" title="'.lang('v_download').
											' '.$source['name'].'" rel="nofollow" target="_blank">'.$source['name'].'</a>';
										$download .= '<a href="'.$source['short'].'" class="servers" title="'.lang('v_download').
														' '.$source['name'].'" rel="nofollow" target="_blank"><img src="'.$source['url_img'].
														'" width="150" height="150" alt="'.lang('v_download').' '.$source['name'].'" /></a>';
									}
									echo substr($ser, 1);
								}
								?></td>
							</tr>
							<tr>
								<td class="hed"><?php echo lang('v_actors'); ?></td>
								<td><?php //Nombres de los actores
								if(is_array($episode['cast'])){
									$ser = '';
									foreach($episode['cast'] as $keys => $source){
										$ser .= ', <a href="'.Sys::$url_base.$lang_url.'actors~'.$source['id'].'/'.'" class="reparto" title="'.$source['name'].'">'.$source['name'].'</a>';
									}
									echo substr($ser, 1);
								}
								?></td>
							</tr>
						</table>
						
						<div class="share">
							<div class="share-twit">
								<a href="https://twitter.com/share" class="twitter-share-button" data-count="vertical" data-lang="<?php echo $lang_m; ?>">Tweet</a>
								<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
							</div>
							
							<div class="share-plus">
								<!-- Place this tag where you want the +1 button to render -->
								<g:plusone size="tall" href="<?php echo $url_article; ?>"></g:plusone>
								
								<!-- Place this render call where appropriate -->
								<script type="text/javascript">
								  window.___gcfg = {lang: '<?php echo $lang_m; ?>'};
								
								  (function() {
								    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
								    po.src = 'https://apis.google.com/js/plusone.js';
								    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
								  })();
								</script>
							</div>
							<div class="share-face">
								<?php $face_lang = $lang_m.($lang_m=='es'? '_LA': '_US'); ?>
								<div id="fb-root"></div>
								<script>(function(d, s, id) {
								  var js, fjs = d.getElementsByTagName(s)[0];
								  if (d.getElementById(id)) {return;}
								  js = d.createElement(s); js.id = id;
								  js.src = "//connect.facebook.net/<?php echo $face_lang; ?>/all.js#xfbml=1&appId=298068703552361";
									  fjs.parentNode.insertBefore(js, fjs);
									}(document, 'script', 'facebook-jssdk'));</script>
								<div class="fb-like" data-href="<?php echo $url_article; ?>" data-send="false" data-layout="box_count" data-width="20" data-show-faces="false"></div>
							</div>
						</div>
					</div>
				</div>
				<div class="clear"></div>
				<strong class="mini-subtitle"><?php echo lang('v_synopsis') ?></strong>
				<p class="sinop"><?php //Sinopsis
						echo ($lang != 'spa'? $episode['synopsis_'.$lang]: $episode['synopsis_spa']); ?></p>
			</div>
			
			<div class="post-extra">
				<nav>
					<ul>
						<li<?php echo $options['online'][0].lang('v_episode_online').$options['online'][1]; ?></li>
						<li<?php echo $options['download'][0].lang('v_download_episode').$options['download'][1]; ?></li>
						<li<?php echo $options['capturs'][0].lang('v_capturs').$options['capturs'][1]; ?></li>
						<li<?php echo $options['trailer'][0].lang('v_trailer').$options['trailer'][1]; ?></li>
					</ul>
					<div class="clear"></div>
				</nav>
				<div class="extra-conte corner-all">
				<?php 
					switch ($opc_selected) {
						case 'online':
							echo '<div id="absoluto" class="absoluto"></div>
								<iframe id="reproductor" name="reproductor" width="620" height="360" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" 
								src="'.base_url('player/sin_plugin/?video='.$episode['id_episode'].'&t=e').'"></iframe>';
						break;
						case 'download':
							echo $download;
						break;
						case 'capturs':
							if(isset($episode['screenshots'])){
								$links = '';
								$conta = 1;
								foreach ($episode['screenshots'] as $key => $value) {
									if($value['primary'] == 1)
										echo '<a href="'.$value['url_screen'].'" target="_blank"><img src="'.$value['url_screen'].'" width="615" /></a>';
									else{
										$links .= '<a href="'.$value['url_screen'].'" class="screen" target="_blank">'.lang('v_screenshot').' '.$conta.'</a>';
										$conta++;
									}
								}
								echo $links;
							}
						break;
						case 'trailer':
							if(isset($episode['trailer'])){
								if($episode['trailer'] != '')
									echo '<iframe width="560" height="315" class="iftrailer" src="http://www.youtube.com/embed/'.$episode['trailer'].'" frameborder="0" allowfullscreen></iframe>';
							}
						break;
					}
				?>
				</div>
				<div class="clear"></div>
				<a id="link_tutorial" href="<?php echo base_url('application/images/Pasos-Usar-Reproductor-Online.jpg'); ?>" target="_blank"><?php echo lang('v_how_use_player'); ?></a>
				
				<nav class="episodes">
					<strong class="mini-subtitle"><?php echo lang('v_episode') ?>s</strong>
					<ul>
			<?php
				if(is_array($season['episodes'])){
					$ser = '';
					foreach($season['episodes'] as $keys => $source){
						if($source['id'] == $episode['id_episode'])
							echo '<li>'.lang('v_episode').' '.$source['no_episode'].' - '.$source['title'].'</li>';
						else
							echo '<li><a href="'.base_url($lang_url.'series~'.$source['id'].'~'.$season['clean_title'].'~'.$source['clean_title']).
							'" class="reparto">'.lang('v_episode').' '.$source['no_episode'].' - '.$source['title'].'</a></li>';
					}
				} 
			?>
					</ul>
				</nav>
				
				<div class="clear"></div>
				<div class="comments_face">
					<strong class="mini-subtitle"><?php echo lang('v_comments') ?></strong>
					<div id="fb-root"></div>
					<script>(function(d, s, id) {
					  var js, fjs = d.getElementsByTagName(s)[0];
					  if (d.getElementById(id)) {return;}
					  js = d.createElement(s); js.id = id;
					  js.src = "//connect.facebook.net/<?php echo $face_lang; ?>/all.js#xfbml=1&appId=298068703552361";
					  fjs.parentNode.insertBefore(js, fjs);
					}(document, 'script', 'facebook-jssdk'));</script>
					<div class="fb-comments" data-href="<?php echo $url_article; ?>" data-num-posts="30" data-width="640"></div>
				</div>
			</div>
		</article>
<?php
	}
?>
		
	</section>

